package com.cskaoyan.market.service;

import com.cskaoyan.market.db.domain.MarketBrand;
import com.cskaoyan.market.db.domain.MarketBrandExample;
import com.cskaoyan.market.db.mapper.MarketBrandMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author XuFeiLong
 * @DATE: 2023/4/1
 * @TIME: 16:13
 */
@Service
public class WxBrandServiceImpl implements WxBrandService {

    @Autowired
    MarketBrandMapper brandMapper;



    @Override
    public List<MarketBrand> list(Integer page, Integer limit) {
        MarketBrandExample brandExample = new MarketBrandExample();
        PageHelper.startPage(page,limit);
        List<MarketBrand> brandList = brandMapper.selectByExample(brandExample);

        return brandList;
    }

    /**
     *  根据id, 显示出品牌表中的品牌信息
     * @param id
     * @return
     */
    @Override
    public MarketBrand detail(Integer id) {

        MarketBrandExample brandExample = new MarketBrandExample();
        brandExample.or().andIdEqualTo(id);
        MarketBrand marketBrand = brandMapper.selectOneByExample(brandExample);

        return marketBrand;
    }
}
